package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.DuihuanInfo;
import com.sphd.restaurantsystem.model.JifenCommodityModelImpl;
import com.sphd.restaurantsystem.view.JifenCommodityView;

import java.util.List;

/**
* Created by Hu on 2016/12/22
*/

public class JifenCommodityPresenterImpl implements JifenCommodityPresenter {
    JifenCommodityModelImpl commodityModel;
    JifenCommodityView jifenCommodityView;

    public JifenCommodityPresenterImpl(JifenCommodityView jifenCommodityView) {
        this.jifenCommodityView = jifenCommodityView;
        commodityModel=new JifenCommodityModelImpl();
    }

    @Override
    public void addData(String url) {
        jifenCommodityView.showLoading();
        commodityModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {

    }

    @Override
    public void recList(List<DuihuanInfo> duihuanInfos) {
        jifenCommodityView.recList(duihuanInfos);
        jifenCommodityView.dissLoading();
    }

    @Override
    public void delUrl(String url) {
        commodityModel.delUrl(url,this);
    }

    @Override
    public void delRes(int res) {
        jifenCommodityView.recRes(res);
        jifenCommodityView.dissLoading();
    }
}